<!DOCTYPE html>

<html lang="en">

    <head>

        <!-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
        <meta charset="utf-8"/>
        <meta content="initial-scale=1, width=device-width" name="viewport"/>

        <!-- documentation at http://getbootstrap.com/, alternative themes at https://www.bootstrapcdn.com/bootswatch/ -->
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

        <link href="{{ url_for('static', filename='styles.css') }}" rel="stylesheet"/>

        <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

        <title>C$50 Finance: {% block title %}{% endblock %}</title>

    </head>

    <body>

        <div class="container">

            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <button aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="{{ url_for('index') }}"><span class="blue">C</span><span class="red">$</span><span class="yellow">5</span><span class="green">0</span> <span class="red">Finance</span></a>
                    </div>
                    <div class="collapse navbar-collapse" id="navbar">
                        {% if session.user_id %}
                            <ul class="nav navbar-nav">
                                <li><a href="{{ url_for('quote') }}">Quote</a></li>
                                <li><a href="{{ url_for('buy') }}">Buy</a></li>
                                <li><a href="{{ url_for('sell') }}">Sell</a></li>
                                <li><a href="{{ url_for('history') }}">History</a></li>
                                <li><a href="{{ url_for('loan') }}">Loan Money</a></li>
                            </ul>
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="{{ url_for('logout') }}">Log Out</a></li>
                            </ul>
                        {% else %}
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="{{ url_for('register') }}">Register</a></li>
                                <li><a href="{{ url_for('logout') }}">Log In</a></li>
                            </ul>
                        {% endif %}
                    </div>
                </div>
            </nav>

            {% if get_flashed_messages() %}
                <header>
                    <div class="alert alert-info" role="alert">
                        {{ get_flashed_messages() | join(" ") }}
                    </div>
                </header>
            {% endif %}

            <main>
                {% block main %}{% endblock %}
            </main>
            
        </div>

    </body>

</html>
